// app.js
App({
  globalData:{
    openid:null
  },
  onLaunch() {
   wx.cloud.init({
     env: 'lianxiaojie-6gewoalt07084062',
     traceUser: true,
   })
   this.getOpenid()
  },
   //获取当前时间
  getTime(){
    let d = new Date();
    let month = d.getMonth() + 1 +'-';
    let date = d.getDate()+' ';
    let hours = d.getHours()+':';
    let minutes = d.getMinutes()+':';
    let seconds = d.getSeconds();
    let curDateTime = d.getFullYear() + '-';
    if(hours<=9){
      hours = '0'+ hours
    }
    if(minutes<=9){
      minutes = '0'+ minutes
    }
    if(seconds<=9){
      minutes = '0'+ seconds
    }
    return curDateTime+month+date+hours+minutes+seconds
  } ,
  getOpenid(){
      wx.cloud.callFunction({
        name:'getOpenid'
      }).then(res=>{
        console.log('云函数获取的openid是',res.result.openid);
        this.globalData.openid = res.result.openid
      })
  }
  
})
